﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Linq;
using System.Data.Entity;
using web_mvc.dto;
using System.Drawing.Printing;

namespace web_mvc
{
    internal class SchoolContext : DbContext
    {
        public SchoolContext(string nameOrConnectionString) : base(nameOrConnectionString)
        {
            Database.SetInitializer<SchoolContext>(
                // 如果领域模型变更了，那么就drop 数据库，再创建新数据库
                    new DropCreateDatabaseIfModelChanges<SchoolContext>()
                );

        }

        public DbSet<Student> Students { get; set; }

        public DbSet<Grade> Grades { get; set; }

        

        public DbSet<Course> Courses { get; set; }

        //public DbSet<StudentCourse> StudentCourses { get; set;}

    }
}
